package it.tukano.treditor.modules;

import it.tukano.app.AbstractAppModule;
import it.tukano.app.AppModule;
import it.tukano.misc.ConsoleWrapper;
import it.tukano.reflection.MethodExt;
import it.tukano.treditor.resources.Labels;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JComponent;

public class ConsoleModule extends AbstractAppModule {

    /**
     * Instance initializer
     */
    public ConsoleModule() {
    }

    @Override
    public void startModule(AppModule context) {
        withModule(MainFrame.class, new MethodExt(this, "startModule", MainFrame.class).vfun(MainFrame.class));
    }
    
    public void startModule(MainFrame mainFrame) {
        ConsoleWrapper console = new ConsoleWrapper();
        JComponent consolePanel = console.getJPanel();
        consolePanel.setName(Labels.getInstance().getLabelValue(Labels.LabelKey.CONSOLE));
        consolePanel.setPreferredSize(new Dimension(200, 200));
        mainFrame.install(consolePanel, BorderLayout.SOUTH, true);
        console.start();
    }
}
